Skip to content

feat: refactored to use new endpoint SavingsGhoIncentive#2963

Open
AGMASO wants to merge 2 commits intoSDK-779-interface-incentivesfrom
fix/sgho-rewards-with-new-endpoint
Open

feat: refactored to use new endpoint SavingsGhoIncentive#2963
AGMASO wants to merge 2 commits intoSDK-779-interface-incentivesfrom
fix/sgho-rewards-with-new-endpoint

Conversation

@AGMASO
Copy link
Copy Markdown
Collaborator

@AGMASO AGMASO commented May 1, 2026

General Changes

  • Refactor to use the new savingsGhoIncentive GraphQL endpoint for all sGHO APR/APY displays and tooltips, while keeping reserve-level Merit incentives scoped to actual reserve incentives.

Developer Notes

Add any notes here that may be helpful for reviewers.


Reviewer Checklist

Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.

  • End-to-end tests are passing without any errors
  • Code changes do not significantly increase the application bundle size
  • If there are new 3rd-party packages, they do not introduce potential security threats
  • If there are new environment variables being added, they have been added to the .env.example file as well as the pertinant .github/actions/* files
  • There are no CI changes, or they have been approved by the DevOps and Engineering team(s)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
interface Ready Ready Preview, Comment May 4, 2026 0:00am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors sGHO-related APR/APY fetching and UI to use the new savingsGhoIncentive GraphQL endpoint, and wires that data into the various sGHO/staking surfaces and incentive tooltips.

Changes:

  • Added useSavingsGhoIncentive hook to query the new savingsGhoIncentive GraphQL endpoint.
  • Replaced sGHO incentive displays/tooltips to use SavingsGhoIncentivesButton (backed by the new hook).
  • Removed legacy useStakeTokenAPR and relaxed filtering in useMeritIncentives.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/modules/staking/StakingPanelNoWallet.tsx Switches staking incentives button to the new sGHO incentives source.
src/modules/staking/GhoStakingPanel.tsx Switches staking incentives button to the new sGHO incentives source.
src/modules/sGho/SGhoHeader.tsx Replaces legacy APR hook usage with useSavingsGhoIncentive for header APY display and user estimates.
src/modules/sGho/SGhoDepositPanel.tsx Updates “Current APY” calculation and tooltip button to use the new endpoint.
src/modules/reserve-overview/Gho/SavingsGho.tsx Uses useSavingsGhoIncentive and new incentives button for Savings GHO panel.
src/modules/markets/Gho/GhoBanner.tsx Updates Savings GHO banner APY display to use the new endpoint.
src/hooks/useStakeTokenAPR.ts Removes the legacy adapter hook (no longer used).
src/hooks/useSavingsGhoIncentive.ts Introduces the new GraphQL hook for savingsGhoIncentive.
src/hooks/useMeritIncentives.ts Removes actionKey/protocolAction allowlist filtering from Merit incentives selection.
src/components/transactions/SavingsGho/SavingsGhoModalDepositContent.tsx Replaces merit incentives APR sourcing with the new endpoint for modal details.
src/components/incentives/IncentivesButton.tsx Adds SavingsGhoIncentivesButton and refactors Merit button rendering to reuse shared content.
Comments suppressed due to low confidence (1)

src/hooks/useMeritIncentives.ts:166

  • Removing the actionKeyprotocolAction allowlist means stake-scoped Merit campaigns (e.g. ethereum-sgho, ethereum-stkgho) can now be returned for generic supply/borrow contexts wherever useMeritIncentives is used (markets/dashboard/tooltips). Consider restoring this filtering (or an equivalent backend-side filter) to avoid showing stake-only campaigns in the wrong protocol context.
  for (const m of merits) {
    let apr = 0;
    const enriched = m as unknown as EnrichedMerit;
    const rewardTokenAddress = enriched.rewardTokenAddress ?? '';
    const rewardTokenSymbol = enriched.rewardTokenSymbol ?? '';

    if (m.__typename === 'MeritSupplyIncentive') {
      apr = parseFloat(m.extraSupplyApr.formatted);
    } else if (m.__typename === 'MeritBorrowIncentive') {
      apr = parseFloat(m.borrowAprDiscount.formatted);
    } else if (m.__typename === 'MeritBorrowAndSupplyIncentiveCondition') {
      apr = parseFloat(m.extraApr.formatted);
    }

    if (!Number.isFinite(apr) || apr <= 0) continue;

    totalMeritAPR += apr;
    const actionKey = enriched.actionKey ?? '';
    if (actionKey) {
      activeActions.push(actionKey);
      actionMessages[actionKey] = {
        customMessage: enriched.customMessage ?? undefined,
        customForumLink: enriched.customForumLink ?? undefined,
      };
      if (!firstAction) firstAction = actionKey;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/reserve-overview/Gho/SavingsGho.tsx
Comment thread src/components/transactions/SavingsGho/SavingsGhoModalDepositContent.tsx Outdated
Comment thread src/modules/reserve-overview/Gho/SavingsGho.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants